package com.fitbet.admin.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Limit;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.fitbet.admin.entity.principal.Principal;

/**
 * @author xiaoHU
 *
 */
@Dao("hibernate")
public interface PrincipalDao {

    /**
     * @return
     */
    @Query("SELECT COUNT(*) FROM Principal")
    public int count();

    /**
     * @param beginIndex
     * @param maxResult
     * @return
     */
    @Limit
    @Query("FROM Principal")
    public List<Principal> listByPage(@Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);

    /**
     * @param name
     * @return
     */
    @Query("FROM Principal WHERE disabled = false AND name = :name")
    public Principal load(@Variable("name") String name);

    /**
     * @param name
     * @return
     */
    @Query("FROM Principal WHERE name =:name")
    public List<Principal> loads(@Variable("name") String name);

}
